<%--
  Created by IntelliJ IDEA.
  User: 33333333
  Date: 2020/9/22
  Time: 16:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="card">
    <h6 class="card-header">最近浏览</h6>
    <div class="card-body">
        <div class="last-view">
            <dl id="parent" class="clearfix">
                <%--        <dt><img src="images/product/0_tiny.gif" /></dt>--%>
                <%--        <dd><a href="product-view.html">法国德菲丝松露精品巧克力500g/盒</a></dd>--%>
                <%--        <dt><img src="images/product/0_tiny.gif" /></dt>--%>
                <%--        <dd><a href="product-view.html">法国德菲丝松露精品巧克力500g/盒</a></dd>--%>
            </dl>
        </div>
    </div>
</div>

<script>
    (function (){
        const temp = document.getElementById("parent");
        const list = JSON.parse(localStorage.getItem("lastList"));
        for (let i = list.length - 1; i >= 0; i--){
            const dt = document.createElement("dt");
            const img = document.createElement("img");
            img.src = "${pageContext.request.contextPath}/images/product/" + list[i].epFileName;
            const dd = document.createElement("dd");
            const a = document.createElement("a");
            a.href = "${pageContext.request.contextPath}/f-product/detail?epId=" + list[i].epId;
            a.innerText = list[i].epName;
            temp.appendChild(dt);
            dt.appendChild(img);
            temp.appendChild(dd);
            dd.appendChild(a);
        }

    })();
</script>